<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的火柴人</title>
    <style>
        body{
            background-color: black;
        }
        .contains{
            width: 300px;
            height: 300px;
            margin: 50px;
        }
        .person{
            position: absolute;
            top: 150px;
            left: 150px;
            animation: move 5s infinite ease; /* 动画名称和持续时间 */ /* 无限循环 */
        }
        .head{
            width: 20px;
            height: 20px;
            border: 5px solid #eee;
            border-radius: 50%;
            position: absolute;
            top: -30px;
            left: -6px;
            animation: headrotate 1s linear 0s infinite; /* 动画名称和持续时间 */ /* 无限循环 */
        }
        .troso{
            width: 0px;
            height: 50px;
            border: 3px solid #eee;
            position: absolute;
            top:-2px;
            left: 0px

        }
        .person .part{
            position:absolute;
            left: 5px;
            top: 48px;
        }

        .person .part.arm{
            width: 30px;
            height: 40px;
            border-left: 5px solid #eee;
            border-bottom: 5px solid #eee;
            position: absolute;
            top: -2px;
            left: 0px; 
            transform-origin: 0% 0% 0px; /* 旋转中心点 */
            animation: pump 0.5s infinite ease; /* 动画名称和持续时间 */ /* 无限循环 */
        }

        .person .part.arm.left{
            transform: rotate3d(0,0,1,-60deg);
        }

        .person .part.arm.two{
            transform: rotate3d(0,0,1,70deg);
            animation-delay: 0.3s; /* 延迟0.5秒开始动画 */
        } 

        .person .part.leg{
            width: 50px;
            height: 50px;
            border-right: 5px solid #eee;
            border-top: 5px solid #eee;
            transform-origin: 0% 0% 0px; /* 旋转中心点 */
            animation: run 0.5s infinite ease; /* 动画名称和持续时间 */ /* 无限循环 */
        }

        .person .part.leg.left{
            transform: rotate3d(0,0,1,100deg);
        }

        .person .part.leg.right{
            transform: rotate3d(0,0,1,10deg);
            animation-delay: 0.3s; /* 延迟0.5秒开始动画 */
        }

        /* 动画实现 */
        @keyframes headrotate{
            0%{
                transform: rotate3d(0,0,1,5deg); /* 恢复原状 */ 
            }
            25%{
                transform: rotate3d(0,0,1,30deg) skew(10deg, 0deg); /* 倾斜 */ 
            }
            50%{
                transform: rotate3d(0,0,1,5deg); /* 旋转10度 */ 
            }
            75%{
                transform: rotate3d(0,0,1,20deg) skew(10deg,0deg); /* 倾斜 */ 
            }
            100%{
                transform: rotate3d(0,0,1,-30deg) skew(8deg,0deg); /* 恢复原状 */ 
            }
        }

        @keyframes pump{
            0%{
                transform: rotate3d(0,0,1,90deg); /* 恢复原状 */ 
            }
            50%{
                transform: rotate3d(0,0,1,-70deg); /* 旋转10度 */ 
            }
            100%{
                transform: rotate3d(0,0,1,90deg);
            }
        }

        @keyframes run{
            0%{
                transform: rotate3d(0,0,1,20deg); /* 恢复原状 */ 
            }
            50%{
                transform: rotate3d(0,0,1,130deg); /* 旋转10度 */ 
            }
            100%{
                transform: rotate3d(0,0,1,20deg);
            }
        }

        @keyframes move {
            0%{
                transform: translate(-20px,0px) /* 从屏幕外进入 */ 
            }
            100%{
                transform: translate(900px,0px);
            }
            
        }


    </style>
</head>
<body>

    <div class="contains">
        <div class="person">
            <div class="head"></div>
            <div class="part arm left"></div>
            <div class="part arm two"></div>
            <div class="troso"></div>
            <div class="part leg left"></div>
            <div class="part leg right"></div>
        </div>
    </div>
    
</body>
</html>